﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace Commission.Models
{
    public class Trading
    {
        public int TradingId { get; set; }

        public int CustomerId { get; set; }

        [ForeignKey("CustomerId")]
        public virtual Customer Customer { get; set; }

        public int ProductId { get; set; }

        [ForeignKey("ProductId")]
        public virtual Product Product { get; set; }

        public int Quantity { get; set; }

        public decimal Amount { get; set; }

        [DataType(DataType.Date)]
        public DateTime TradeDate { get; set; }

        [DataType(DataType.Date)]
        public DateTime? DeliveryDate { get; set; }

        public int TransactionHistoryId { get; set; }

        public TradeStatus TradeStatus { get; set; }

        public int CreatedUserId { get; set; }

        public DateTime CreatedAt { get; set; }

        public int UpdatedUserId { get; set; }

        public DateTime UpdatedAt { get; set; }

        public int? DeletedUserId { get; set; }

        [DataType(DataType.Date)]
        public DateTime? DeletedAt { get; set; } 
    }

    public enum TradeStatus {
        Order = 1, // mới đặt hàng
        Paid = 2, // đã trả tiền, trường hợp đăng ký hội viên
        Finish = 3, // Đã nhận hàng
        Cancel = 4, // hủy
    }
}